home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 1.iso
/
ARGONET
/
PD
/
PROGRAMMING
/
DESKLIBC
/
SOURCES.ZIP
/
DeskLib
/
!DLSources
/
Libraries
/
Icon
/
c
/
SetDouble
< prev
next >
Wrap
Text File
|
1995-07-08
|
794b
|
27 lines
#include <stdio.h>
#include <string.h>
#include "DeskLib:Wimp.h"
#include "DeskLib:WimpSWIs.h"
#include "DeskLib:Icon.h"
extern void Icon_SetDouble(window_handle w, icon_handle i,
double value, int decimalplaces)
/*
* Sets the given icon's text to hold the number in "value". (and redraws icon)
* After the decimal place, up to "decimalplaces" digits will be printed
* If the number is too big (too many digits), it will be truncated to fit
* (which may completely destroy the value you wished to represent, or
* just reduce its accuracy)
* If unable to set the text (incorrect icon type), it returns quietly
*/
{
char text[32], format[16];
sprintf(format, "%%.%df", decimalplaces);
sprintf(text, format, value);
Icon_SetText(w, i, text);
}